xl: Implement PCI passthrough force removal
authorGianni Tedesco <gianni.tedesco@citrix.com>
Wed, 6 Oct 2010 16:38:15 +0000 (17:38 +0100)
committerGianni Tedesco <gianni.tedesco@citrix.com>
Wed, 6 Oct 2010 16:38:15 +0000 (17:38 +0100)
commit77fea72b068d25afb7e63947aba32b487d7124a2
treeb66e87a8318fff6d55c1649bd54fa31fcf7b80d1
parentb5d197b17dae4f942782de2cda2fc3b072687d97
xl: Implement PCI passthrough force removal

This fixes two errors with removing PCI devices from HVM domains. The
first error is that the handling of "pci-rem" device-model command is
erroneously implemented in qemu and difficult (impossible?) to get
right.

For example, during domain shutdown there can be a race where the guest
OS unloads it's drivers and perhaps even shuts down PCI subsystem before
the pci-rem command has been received by qemu. This means that no OS is
present to write to the port which causes the dm command to be
acknowledged.

We fix this by implementing a 'force removal' option to
libxl_device_pci_remove which is always set to 1 during guest shutdown.
It can be optionally enabled on the xl command line for other occasions.

The second error is that if a guest OS doesn't respond to the SCI
interrupt and therefore the pci-rem dm command, which can happen if the
guest OS has no ACPI PCI hotplug support, then device removal bails with
an error but only AFTER removing the device from xenstore. This means
that xenstore gets in to an inconsistent state where an assigned device
also appears to be assignable.

This is fixed by moving xenstore device removal to occur only after the
device has really been removed.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
committer: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
tools/libxl/libxl.h
tools/libxl/libxl_pci.c
tools/libxl/xl_cmdimpl.c